﻿using System;

namespace AutoUnitTest.Common.GraphConvertion
{
    using System.Linq;
    using System.Collections.Generic;

    public class MethodGraphConvertor
    {
        public static Graph TestForMethod(Graph methodGraph)
        {
            if(methodGraph == null) throw new ArgumentNullException("methodGraph");

            var vMethod = methodGraph.VertexList.FirstOrDefault(v => v.Type.Name == "function");
            if(vMethod == null) return null;

            foreach (Edge incomingEdge in vMethod.IncomingEdges)
            {
                var vExpr = incomingEdge.StartVertex;
                if (vExpr.Type.Name == "expression" && vExpr.Name == "if")
                {
                }
            }

            return null;
        }

       /* private static IEnumerable<Vertex> GetParamsFrom(Vertex vMethod)
        {
            IEnumerable<Vertex> expParams;
            foreach (var eMethodParam in vMethod.IncomingEdges.Where(v => v.Type.Name == "p"))
            {
 
            }
        }*/
    }
}